// 格式化时间 小于10的话前面补零
export const formatTime = (time) => {
    // 格式化时间
    const date = new Date(time);
    const year = date.getFullYear();
    const month = date.getMonth() + 1;
    const day = date.getDate();
    const hour = date.getHours();
    const minute = date.getMinutes();
    const second = date.getSeconds();

    // 格式化数字，小于10的话前面补零
    const formatNumber = (num) => {
        return num < 10 ? `0${num}` : num;
    }
    return `${year}-${formatNumber(month)}-${formatNumber(day)} ${formatNumber(hour)}:${formatNumber(minute)}:${formatNumber(second)}`;
}


